home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / pcxkt3.zip / SHOWCGA.PAS < prev    next >
Pascal/Delphi Source File  |  1990-10-24  |  1KB  |  45 lines

  1. program SHOWCGA;
  2.  
  3. (* Sample implementation of PCX.TPU for CGA. You need to have the
  4.    Turbo .BGI files in the current directory, or change Initgraph.
  5.    Enter a valid filename (without extension) on the command line
  6.    or, if you're running under Turbo, in the Parameters box.
  7.  
  8.    For 4-color images in the standard colors, just change Grmode to CGAC1 *)
  9.  
  10. uses GRAPH, DOS, CRT, PCX;
  11.  
  12. var   grdriver, grmode: integer;
  13.       textpage0: byte absolute $b800:0000;
  14.       textsave: pointer;
  15.       cursorx, cursory: byte;
  16.  
  17. begin
  18. clrscr;
  19. pcxfilename:= paramstr(1) + '.PCX';
  20. grdriver:= cga; grmode:= cgahi;              { 2-color 640x200 format }
  21. read_pcx_file(grdriver, pcxfilename);
  22. if file_error then
  23. begin
  24.   writeln('File ', fexpand(pcxfilename), ' not found.');
  25.   halt;
  26. end;
  27. writeln('This is a text screen, which we will save and restore.');
  28. writeln;
  29. write('Strike any key. ');
  30. cursorx:= wherex; cursory:= wherey;
  31. getmem(textsave, 4000);
  32. move(textpage0, textsave^, 4000);               { Save text screen }
  33. repeat until readkey <> #1;
  34. initgraph(grdriver, grmode, '');                { Initialize graphics }
  35. move(buff0^, screenbuff0, 8000);                { Display the image }
  36. move(buff1^, screenbuff1, 8000);
  37. repeat until readkey <> #1;
  38. closegraph;
  39. move(textsave^, textpage0, 4000);               { Restore text screen }
  40. gotoxy(cursorx, cursory);
  41. freemem(textsave, 4000);
  42. repeat until readkey <> #1;
  43. clrscr;
  44. end.
  45.